package com.guaju.yueshangclothing.viewmodel.login;

import android.content.Intent;
import android.databinding.BaseObservable;
import android.text.TextUtils;
import android.view.View;

import com.guaju.yueshangclothing.activity.MainActivity;
import com.guaju.yueshangclothing.utils.NotifyUtil;
import com.guaju.yueshangclothing.utils.ToastUtil;

/**
 * Created by guaju on 2018/10/12.
 */

public class SetupPasswordVM extends BaseObservable{


    public String password1;
    public String password2;



    public void login(View v,String password1, String password2){
        if (!NotifyUtil.isLetterAndDigit(password1)){
            ToastUtil.show("密码格式不正确,请重新输入！");
        }else if (!TextUtils.equals(password1,password2)){
            ToastUtil.show("两次密码输入不一致,请重新输入！");
        }else{
            //服务器校验
            Intent intent = new Intent(v.getContext(), MainActivity.class);
            v.getContext().startActivity(intent);
        }
    }


    public void done(View v){
        login(v,password1, password2);
    }
}
